#ifndef FT_DATA_H
#define FT_DATA_H
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <vector>
using namespace cv;
using namespace std;

class ft_data
{
public:
    vector<int> symmetry;                    //indices dos pontos de simetria
    vector<Vec2i> connections;               //indices dos pontos de conexao
    vector<string> imnames;                  //nome das imagens
    vector<vector<Point2f> > points;         //points de controle

    inline int n_images(){return imnames.size();}

    Mat                                             //idx -> indice da imagem para carregar do file system
    get_image(const int idx, const int flag = 2);   //flag -> 0=gray,1=gray+flip,2=rgb,3=rgb+flip

    vector<Point2f>                                         //indice para imagem que contem os pontos
    get_points(const int idx, const bool flipped = false);  //flip points? (espelhamento)

    void rm_incomplete_samples();   //removes samples which have missing point annotations

    void
    rm_sample(const int idx);                //remove idx'th sample

    void
    draw_points(Mat &im,                     //image to draw on
                const int idx,               //index of shape
                const bool flipped = false,  //flip points?
                const Scalar color=CV_RGB(255,0,0),//color to draw points in
                const vector<int> &pts=vector<int>());//indices of points to draw

    void
    draw_sym(Mat &im,                        //image to draw on
             const int idx,                  //index of shape
             const bool flipped = false,     //flip points?
             const vector<int> &pts=vector<int>());//indices of points to draw

    void
    draw_connect(Mat &im,                    //image to draw on
                 const int idx,              //index of shape
                 const bool flipped = false, //flip points?
                 const Scalar color=CV_RGB(0,0,255),//color to draw points in
                 const vector<int> &con=vector<int>());//indices of connections

    void  write(FileStorage &fs) const;            //file storage object to write to

    void  read(const FileNode& node);              //file storage node to read from
};

#endif // FT_DATA_H
